package com.hjl.spring6.bean.iocXml.di;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author ServivE
 * @version 0.1
 * @className TestStudentByDi
 * @description
 * @date 2024/8/6 14:36
 * @since jdk11
 */
public class TestStudentByDi {
    @Test
    public void testDIBySet(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("beans-di.xml");
        Student studentOne = ac.getBean("student", Student.class);
        System.out.println(studentOne);
    }
    @Test
    public void testDIByConstructor(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("beans-di.xml");
        Student studentOne = ac.getBean("studentTwo", Student.class);
        System.out.println(studentOne);
    }
}
